/** CS2340 Spring 2011 Project
 *  Team: 40 Jiggawatt Hard Driver
 *  Suk Hwan Hong
 *  Rhys Saraceni
 *  Travis Cooper
 *  Luke Stubb
 *
 * @author 40 Jiggawatt Hard Driver
 * @version 1.0 
 */

// $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.alwaysOverridetoString.alwaysOverrideToString
package edu.gatech.jiggawatt.office.model;

import java.io.Serializable;
import java.util.List;

/**
 * Represents Invoice
 * @author 40 Jiggawatt Hard Driver
 * @version 1.0 
 */
public class Invoice implements Serializable { // $codepro.audit.disable declareDefaultConstructors
	
	private String name;
	private Date date;
	private Time time;
	private String doctorName;
	private List<Bill> bills;
	
	private double amount;
	
	/**
	 * Creats an invoice
	 * @param name
	 * @param date
	 * @param time
	 * @param doctorName
	 */
	public Invoice(String name, Date date, Time time, String doctorName)
	{
		this.name = name;
		this.date = date;
		this.time = time;
		this.doctorName = doctorName;
	}

	/**
	 * sets name
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * gets name
	 * @return name
	 */
	public String getName() {
		return name;
	}

	/**
	 * sets date
	 * @param date
	 */
	public void setDate(Date date) {
		this.date = date;
	}
	
	/**
	 * gets date
	 * @return date
	 */
	public Date getDate() {
		return date;
	}
	
	/**
	 * sets doctor's name
	 * @param doctorName
	 */
	public void setDoctorName(String doctorName) {
		this.doctorName = doctorName;
	}
	
	/**
	 * gets doctor's name
	 * @return doctor's name
	 */
	public String getDoctorName() {
		return doctorName;
	}
	
	/**
	 * sets amount
	 * @param amount
	 */
	public void setAmount(double amount) {
		this.amount = amount;
	}
	
	/**
	 * gets amount
	 * @return amount
	 */
	public double getAmount() {
		return amount;
	}
	
	/**
	 * adds bill
	 * @param bill
	 */
	public void addBill(Bill bill){
		bills.add(bill);		
		amount += bill.getAmount();
	}
	
	/**
	 * changes bill
	 * @param i index of bill to change
	 * @param bill
	 */
	public void changeBill(int i, Bill bill)
	{
		Bill oldBill = bills.get(i);
		amount -= oldBill.getAmount();
		bills.set(i, bill);
		amount += bill.getAmount();
	}
	
	/**
	 * gets bill
	 * @param i index of bill to get
	 * @return bill
	 */
	public Bill getBill(int i)
	{
		return bills.get(i);
	}
	
	/**
	 * removes bill
	 * @param i index of bill to remove
	 */
	public void removeBill(int i)
	{
		amount -= bills.get(i).getAmount();
		bills.remove(i);
	}
}